<?php
use common\modules\taxonomy\models\TaxonomyCategory;
use common\helpers\Constants;
use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel common\modules\taxonomy\models\search\TaxonomySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */


$category=getGetValue('category');
$categoryModel = TaxonomyCategory::findOne(['id'=>$category]);

$this->title= $categoryModel['name'];
$this->params['breadcrumbs'][] = ['label' => '分类管理', 'url' => ['/taxonomy/taxonomy']];
$this->params['breadcrumbs'][] = $categoryModel['name'];

?>
<p>
    <?= Html::a('返回', ['/taxonomy/taxonomy-category/index'], ['class' => 'btn btn-primary'])?>
    <?= Html::a('新建', ['create','category'=>$category], ['class' => 'btn btn-primary']) ?>
</p>



    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        //'filterModel' => $searchModel,
        'layout' => "{items}\n{pager}",
        'columns' => [
            [
              'class'=>'common\grid\IdColumn',
            ],
            [
                'class'=> 'common\grid\DataColumn',
                'attribute'=> 'name',
				'format'=> 'html',
				'value'=> function ($model,$key,$index,$column){
				    return str_repeat(Constants::TAB_SIZE, $model->level).Html::a($model->name,['taxonomy/update','id'=>$model->id]);
				}
			],

            // 'description',
            // 'contents',

            [
                'class'=>'common\grid\DataColumn',
                'attribute'=>'url_alias',
                'width'=>'250px',
            ],
            [
                'class'=>'common\grid\SortColumn',
            ],
            [
                'class' => 'common\grid\ActionColumn',
				'queryParams'=>['view'=>['category'=>$category]]
            ],
        ],
    ]); ?>

